<!--
 * @description: 
 * @Author: jhw
 * @Date: 2023-05-13 20:17:50
 * @LastEditors: jhw
 * @LastEditTime: 2023-07-16 20:10:49
-->
<template>
  <div>
    <div class="login-box">
      <div class="container">
        <div class="title-container">
          <h1 class="title">登录</h1>
          <h2 class="sub-title">Vue Template</h2>
        </div>
        <el-button type="primary" @click="onLogin">登录</el-button>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { reactive } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { commonApi } from '@/api';

const { test } = commonApi;

const router = useRouter();

const route = useRoute();

console.log(router);
console.log(route);

const formState = reactive({
  user: 'admin',
  password: '123456',
});

const onLogin = async () => {
  console.log(formState);
  // router.replace('/dashboard');
  try {
    const result = await test(formState);
    console.log(result);
  } catch (error) {
    console.log(error);
  }
};
</script>

<style lang="scss" scoped>
.login-box {
  width: 100vw;
  height: 100vh;
  background: url('@/assets/login-bg.png') no-repeat;
  background-size: 100% 100%;

  .container {
    position: absolute;
    top: 22%;
    left: 5%;
    min-height: 500px;

    .title-container {
      font-size: 30px;
      line-height: 80px;
      margin-bottom: 50px;
    }
  }
}
</style>
